package com.etoak.controller;

import com.etoak.service.LikeService;
import com.etoak.vo.LikeVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/like")
public class LikeController {
    @Autowired
    private LikeService likeService;
    @RequestMapping("/pic")
    public LikeVO test(@RequestParam String id, @RequestParam String username){
        String key="like:pic"+id;
        Boolean status=likeService.like(key,username);
        long number=likeService.getNumber(key);
        return new LikeVO(number,status);
    }
}
